package com.tang.controller;


import com.tang.service.BookService;
import com.tang.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;


/**
 * @Author Tom
 * @ClassName DeleteController
 * @Date 2022/1/1 22:25
 */
 @Controller
 @RequestMapping("/delete")
public class DeleteController {
  @Autowired
  private BookService bookService;
  //删除书籍后,重定向到首页
  @DeleteMapping("/deleteBook")
  @ResponseBody
  public Result deleteBook(@RequestParam("bookId") int id, HttpServletRequest request){
      System.out.println(id);
   bookService.deleteBookById(id);

      System.out.println("删除成功1条数据");
      return Result.success("删除成功",null);
  }
}
    